package com.ruitu.mall_98_1.product.activity;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.github.jdsjlzx.recyclerview.LRecyclerView;
import com.ruitu.mall_98_1.R;
import com.ruitu.mall_98_1.dao.P_Global;
import com.ruitu.mall_98_1.product.adapter.ProductListAdapter;
import com.ruitu.router_module.bean.product.Product;

//2019.01.23 用来展示企业(店铺)商品
public class ProductListActivity extends BaseProListActivity {

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_product_list;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setPullRefreshEnabled(false);
        setLoadMoreEnabled(false);

//        productList = (List) getIntent().getExtras().getSerializable("product_list");

        // 折中方案 并不可取
        productList = P_Global.productList;

        productAdapter.setDataList(productList);
    }

    @Override
    protected RecyclerView.Adapter initAdapter() {
        productAdapter = new ProductListAdapter(this);
        productAdapter.type = 2;
        return productAdapter;
    }

    @Override
    protected void onItemClick(View v, int pos) {
        Bundle bundle = new Bundle();
        Product p = (Product) productList.get(pos);
        bundle.putSerializable("product", p);
        startActivity(ProductDetailActivity.class, bundle);
    }

    @Override
    protected LRecyclerView findRecyclerView() {
        return findViewById(R.id.l_rcv_product);
    }

    protected void reqFirst() {
    }

    protected void reqMore() {
    }
}
